On Balance Volume SMA
code:pine
//@version=3
study(title="On Balance Volume SMA", shorttitle="OBV with SMA")
src = close
len1 = input(10, minval=1, title="SMA of OBV Length 1")
len2 = input(50, minval=1, title="SMA of OBV Length 2")
obv = cum(change(src) > 0 ? volume : change(src) < 0 ? -volume : 0*volume)
smaOBV1= sma(obv,len1)
smaOBV2= sma(obv,len2)
plot(obv, color=black, title="OBV")
plot(smaOBV1, title="SMA of OBV", style=line, linewidth=1, color=red)
plot(smaOBV2, title="SMA of OBV", style=line, linewidth=1, color=blue)